add changes to make compilable for hk 1.5.12620#164
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
|
This comment was marked as resolved.
This comment was marked as resolved.
… place, so it can just be created - no clue what to do with `Language.Language.Get(key)` though
- but that requires all `TeamCherry.Localization.Language` to be done dynamically, via strings, as *all* references to it are replaced, even ones manually written here
Hollow Knight received a major update on Feb 5, 2026 (build 12459) which upgraded the engine to Unity 6 (6000.0.61f1) and introduced significant changes to controller input handling, localization, and scene management. This commit updates the Modding API to compile against and work correctly with the new game binaries. Build system changes (Assembly-CSharp.csproj): - Use FrameworkPathOverride to resolve assemblies from Vanilla/ directory instead of individual HintPath references (required for Unity 6 which ships additional TeamCherry.* and System.* assemblies) - Add System.Memory NuGet package (Unity 6 uses ReadOnlySpan<byte> in Texture2D.LoadImage) - Remove Newtonsoft.Json from dependencies (now shipped with the game) - Remove mscorlib override (no longer needed with Unity 6 runtime) Localization system rewrite: - Delete Patches/Language.cs: The Language class moved from the global namespace to TeamCherry.Localization in HK 1.5. The old MonoMod patch targeting "global::Language.Language" no longer resolves. - Add Language/Language.cs: A backwards-compatible shim in the Language.Language namespace that delegates to TeamCherry.Localization via reflection, with MonoModLinkFrom to redirect existing mod references. This allows mods using Language.Language.Get() to continue working without recompilation. - Update ModHooks.cs LanguageGet to call Language.Language.GetInternal instead of the removed Patches.Language.GetInternal. Mod loading initialization (StartManager.cs): - Move mod loading bootstrap from OnScreenDebugInfo.Awake to StartManager.Awake. The OnScreenDebugInfo component was removed in HK 1.5, so it can no longer serve as the mod loading entry point. - Delete Patches/OnScreenDebugInfo.cs (component no longer exists in game). - Rewrite StartManager.Start to match the new HK 1.5 startup sequence: language verification, PlayerPrefs loading, and scene load state management. - Add deferred Menu_Title scene loading: when mod preloading is active, wait for mods to finish loading before transitioning to Menu_Title instead of using the allowSceneActivation pattern. HeroController patches updated for HK 1.5 game logic: - rb2d.velocity → rb2d.linearVelocity (Unity 6 Rigidbody2D API change) - wallSlideVibrationPlayer.Stop() → vibrationCtrl.StopWallSlide() (HK 1.5 replaced individual vibration players with HeroVibrationController) - Attack(): Add grubberfly beam (charm_35) support for wall slashes, change health check from == to >= for grubberfly beam activation on normal/up/down attacks (matches upstream game logic) - SoulGain(): String literals to nameof() for PlayerData fields - LookForQueueInput(): Remove duplicate CanDash() call - TakeDamage(): Rename flag → carefreeShouldStopDamage for clarity, string literals to nameof(), add explicit returns after death/hazard coroutine starts to match upstream flow control, fix ternary null check on damage angle - OrigDashVector(): Simplify ternary for bump velocity readability InputHandler.OnGUI rewrite: - Replace direct Cursor.visible/Cursor.lockState manipulation with calls to the game's SetCursorVisible() method. This preserves the OnCursorVisibilityChange event and proper cursor lock management through SetCursorEnabled(), fixing controller detection and connection mode switching that was broken by the old approach. GameManager patches: - Import TeamCherry.SharedUtils.Encryption (class moved in HK 1.5) - Add SetPausedState() MonoModIgnore declaration - Rewrite PauseToggleDynamicMenu to match HK 1.5 pause/unpause flow (SetPausedState calls, reordered input prevention, reduced wait times) - SceneManager.UnloadSceneAsync → SceneManager.UnloadScene (API change) SceneManager patches: - Replace DrawBlackBorders() full replacement with OnCameraAspectChanged() hook. HK 1.5 refactored border drawing into the camera aspect change handler with persistent border transforms (borderLeft/Right/Up/Down) instead of instantiating new GameObjects each time. - The ModHooks.OnDrawBlackBorders hook is preserved by collecting the border transforms after orig_OnCameraAspectChanged runs. Other patch updates: - MenuSetting.cs: Add new HK 1.5 settings enum values (SwitchFrameCap, Dithering, Noise, ControllerRumble, HudVisibility, CameraShake, NativeInput, XInput, MFi) - MenuButtonList.cs: Null-conditional on menuButtonLists to prevent NullReferenceException during early UIManager initialization - UIManager.cs: Add ADVANCED_GAMEPAD_MENU and ADVANCED_VIDEO_MENU to MainMenuState enum - TakeDamage.cs: Fix Multiplier ternary to match HK 1.5 operand order - PlayMakerUnity2DProxy.cs: Add explicit this. qualifier - ModHooks.cs: Add bounds checking on version string split to handle version formats with fewer than 4 segments Version: hollowknight.version updated to 1.5.12459 Tested on macOS (Apple M2 Pro) with Unity 6000.0.61f1: - Game launches and reaches title screen - Mod menu appears in Options with working mod list - CompassAlwaysOn and GatheringSwarmAlwaysOn load and function correctly - Controller support works (USB/Bluetooth, vibration, mode switching) - Scene transitions, pause menu, and settings menus all functional - No errors in Player.log or ModLog.txt Builds on work started in PR hk-modding#164 by SFGrenade. Closes hk-modding#169.
This comment was marked as resolved.
This comment was marked as resolved.
make compat methods private
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
up hk & mapi version number add slnx for those that like it
and do build the tc localization assembly
…postpatchers & do build the tc localization
don't reference System.Data.DataSetExtensions, Microsoft.CSharp & System.Net.Http do reference most vanilla assemblies don't have assemblyinfos update copyright & use forward slashes
I'd love to use netstandard2.1 instead but it doesn't seem to play well with the prepatcher relinking. This seems to work rather well though. Co-authored-by: "ZackCodes.ai" <gehlotkunal@icloud.com>
Seems like the newest bump gave us an mscorlib that has the reflection stuff baked in, so there's no point in keeping this around. We otherwise would've had to bump this anyways, so this is an overall win.
d32de96 to
dd61c90
Compare
|
CI is gonna keep failing because it's using master's build.yaml :/. I can rebase it onto master directly whenever we have to anyways though. |
…ion();` AS IT MAKES THE GAME START WITHOUT GETTING THE USERS SETTINGS - kinda important if you ask me Assembly-CSharp: only have the StartManager load operation be made when it's actually needed - could possibly slow down game start - but did fix preloading issue, somehow Assembly-CSharp: rename some variables and add a few warnings and don't do an extra quit_to_menu
upgrade Mono.Cecil from 0.11.3 to 0.11.6
|
FYI — built and smoke-tested this branch on macOS arm64 (M4 Pro, macOS 26.4). Platform data point, no source changes. Build
Runtime
Minor
|
|
Unfortunately this is not fixable from our side afaik |
|
I think I fixed the CI: name: build
on:
workflow_call:
secrets:
BINARY_ARCHIVE_DEPLOY_KEY:
description: Deploy key to read from the binary archive repository.
required: true
inputs:
ref:
description: The ref to checkout.
required: true
type: string
upload-artifact:
description: Whether artifacts should be uploaded.
default: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [windows, macos, linux]
archive-ref: [main]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
persist-credentials: false
- name: Read Versions
run: |
HKV=$(cat ./hollowknight.version)
echo "HK_VERSION=$HKV" >> $GITHUB_ENV
- name: Checkout Binaries
uses: actions/checkout@v4
with:
repository: hk-modding/hk-binary-archives
ref: ${{ matrix.archive-ref }}
ssh-key: ${{ secrets.BINARY_ARCHIVE_DEPLOY_KEY }}
sparse-checkout: |
${{ env.HK_VERSION }}/managed.${{ matrix.platform }}.tar.gz
sparse-checkout-cone-mode: false
path: ./hk-binary-archives
persist-credentials: false
- name: Unpack Archive
run: |
mkdir Vanilla
cd ./Vanilla
tar -xzf ../hk-binary-archives/${{ env.HK_VERSION }}/managed.${{ matrix.platform }}.tar.gz
- name: Set RID
run: |
case "${{ matrix.platform }}" in
windows) echo "RID=win-x64" >> $GITHUB_ENV ;;
linux) echo "RID=linux-x64" >> $GITHUB_ENV ;;
macos) echo "RID=osx-x64" >> $GITHUB_ENV ;;
esac
- uses: actions/setup-dotnet@v4
- name: Setup MSBuild
run: |
sudo apt-get update -y
sudo apt-get install -y mono-devel
- name: Restore Dependencies
run: |
dotnet restore
- name: Build PrePatcher
run: |
dotnet build PrePatcher -o PrePatcher/Output -p:Configuration=Release
- name: Build PostPatcher
run: |
dotnet build PostPatcher -o PostPatcher/Output -p:Configuration=Release
- name: Build Assembly-CSharp
run: |
dotnet build Assembly-CSharp --runtime $RID -p:Configuration=Release
- name: Prepare Output
run: |
mkdir -p OutputFinal
cp Assembly-CSharp/bin/Release/net472/$RID/*.dll OutputFinal/
- name: Merge osx dylibs
if: matrix.platform == 'macos'
run: |
wget https://github.com/konoui/lipo/releases/download/v0.9.4/lipo_linux_amd64 -O lipo
chmod +x lipo
./lipo -output libunityscenerepacker.dylib -create ./Assembly-CSharp/packages/unityscenerepacker/2.4.0/runtimes/osx-*/native/libunityscenerepacker.dylib
mv libunityscenerepacker.dylib OutputFinal/
- name: Upload Binary
if: inputs.upload-artifact
uses: actions/upload-artifact@v4
with:
name: build.${{ matrix.platform }}
path: ./OutputFinal/You'll have to change "hk-modding/hk-binary-archives" to include the newer files though, or make a new private repository on your account containing them. |
it is already cared for |
|
Alr |
Notes left to do:
using TMPro;now has to beusing TMProOld;and there's no way aroundLanguage.LanguageCodeTeamCherry.*.dllfiles to hookgen